const vscode = require('vscode');
const copy = require('./copy');

module.exports = {
  async install(e) {
    vscode.window
      .showQuickPick([
        {
          description: '创建 express-Router-Api',
          label: 'api',
          typeValue: 'api',
        },
      ])
      .then(async ({ typeValue }) => {
        const { path } = e; // 获取当前鼠标选择的路径
        // 此处需要写入复制模板的逻辑
        try {
          await copy(typeValue, path.slice(1));
          vscode.window.showInformationMessage('创建成功');
        } catch (err) {
          vscode.window.showErrorMessage('创建失败');
        }
      });
  },
};
